Learn R Programming

poplite (version 0.99.23)

Helper Functions: Functions to facilitate the creation of poplite\'s data structures.

Description

These functions facilitate the creation of TableSchemaList objects from existing or supplementary R data structures such as the data.frame.

Usage

makeSchemaFromData(tab.df, name=NULL,dta.func=NULL)
makeSchemaFromFunction(dta.func, name,…)
correct.df.names(tab.df)

Arguments

tab.df

A data.frame representing a database table

name

Desired name of the database table

dta.func

An optional function which will take a specified object and turn it into a SQLite table. The function parameters should have the same names as the objects supplied to populate.

Arbitary objects provided to the function specified in dta.func. They should be of the same type and be named like the objects to be passed to populate.

Value

makeSchemaFromData

A TableSchemaList object

makeSchemaFromData

A TableSchemaList object

correct.df.names

A data.frame with valid names for SQLite

See Also

'>TableSchemaList

Examples

Run this code
# NOT RUN {
  if (require(Lahman))
  { 
    franches <- makeSchemaFromData(TeamsFranchises, name="team_franch")
    show(franches)
    
    makeSchemaFromFunction(function(x) head(x),  name="team_franch", x=TeamsFranchises)

    test.df <- TeamsFranchises
    names(test.df)[1] <- "franch.ID"
    
    names(test.df)
    
    names(correct.df.names(test.df))
  }
  
# }

Run the code above in your browser using DataLab